<?php

class Admin_Form_Menuadd extends Zend_Form {

    public function init() {
        $this->setMethod('post');

        #name
        $name = new Zend_Form_Element_Text('name');
        $name->setLabel("Menu Name:")
                ->setAttribs(array('placeholder' => 'Enter Menu name'))
                ->setRequired(true);
        #visible
        $visible = new Zend_Form_Element_Select('visible');
        $visible->setLabel("Is menu visible?")
                ->setRequired(true)
                ->addMultiOptions(array(
                    '1' => 'true',
                    '0' => 'false'
        ));

        #menuOption
        $menuDb = new Admin_Model_Menu();
        $parents = $menuDb->getParents(null);
        $menuOption = new Zend_Form_Element_Select('option');
        $menuOption->setLabel("Where it'll displayed?")
                ->setRequired(true)
                ->addMultiOption(0, 'Make it Parent Menu');
        foreach ($parents as $parent) {
            $menuOption->addMultiOption($parent->id, "Child of ".$parent->name);
        }

        #submit
        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setLabel('Add New Menu')
                ->setAttribs(array('class' => 'btn btn-success'));

        #
        $this->addElements(array($name, $visible, $menuOption, $submit));
    }

}

